package com.xjtu.chapter08.thread;

/**
 * @author yjq
 * @version 1.0
 * @date 2021/8/29 21:11
 */
public class DaemonThreadTest extends Thread {
    public DaemonThreadTest() {
        super.setDaemon(true);//将一个用户线程转换为守护线程
        start();
    }

    @Override
    public void run() {
        while (true) {
            System.out.println("running" + Thread.currentThread().getName());
        }

    }

    public static void main(String[] args) throws InterruptedException {
        new DaemonThreadTest();
        Thread.sleep(300);
    }
}
